package com.gyp.model;


import com.gyp.entity.SysUserEntity;

/**
 * @author xyb
 * @Description 全局用户信息
 * @since 17:10 2022/7/14
 */
public class UserContextHolder {

    public static ThreadLocal<SysUserEntity> userToken = new ThreadLocal<>();

    public static SysUserEntity getUserInfo() {
        return userToken.get();
    }

    public static void remove() {
        userToken.remove();
    }

    public static void setUserInfo(SysUserEntity userInfo) {
        userToken.set(userInfo);
    }

    public static Integer getUserId(){
        return userToken.get().getId();
    }





}
